home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10618 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.7 KB  |  68 lines

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
  4. Subject: Re: C/C++ knocks the crap out of Ada
  5. Date: 08 Mar 1996 01:03:21 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar7180321@qcd.lanl.gov>
  8. References: <00001a73+00002504@msn.com> <1996Feb22.005518.13396@leeweyr.sccsi.com>
  9.     <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca> <4h5hgj$vpd@tomquartz.niestu.com>
  10.     <4h7jskINNnph@anvil.ugrad.cs.ubc.ca> <313EDF38.61C1@lfwc.lockheed.com>
  11. NNTP-Posting-Host: qcd.lanl.gov
  12. Mime-Version: 1.0
  13. Content-Type: text
  14. In-reply-to: Ken Garlington's message of Thu, 07 Mar 1996 13:06:01 +0000
  15.  
  16. In article <313EDF38.61C1@lfwc.lockheed.com>
  17. Ken Garlington <GarlingtonKE@lfwc.lockheed.com> writes:
  18.  
  19. KG: Kazimir Kylheku wrote:
  20. KG: > 
  21. KG: > This is false. There are compilers which offer range
  22. checking. In a situation 
  23. KG: > where safety-critical software is designed, such a compiler
  24. should be used. 
  25. KG: 
  26. KG: I thought you were arguing the merits of two languages. Does the C
  27. _language_ 
  28. KG: standard define the syntax and sematics of built-in range
  29. checking? Or does 
  30. KG: "language" in your lexicon include a particular C compiler, with
  31. all the add-on 
  32. KG: tools that one could buy to get it to behave closer to a _standard_ Ada 
  33. KG: implementation? This is the classic non-argument with regard to
  34. languages - that 
  35. KG: a language can be "fixed up" with enough non-standard tools to do
  36. what another 
  37. KG: language has standardized. It's probably true, but it's not a fair
  38. _language_ 
  39. KG: comparison.
  40.  
  41. To be precise, C standard declares all programs that violate array
  42. bounds as illegal, but does not _require_ the compiler to check for
  43. these violations. This is a change from pre-standard days when a
  44. program was considered valid as long as it did not try to access
  45. memory beyond what was allocated to it.
  46.  
  47. As an example,
  48.  
  49. char a2[100][100];
  50. char *a = &a2[0][0];
  51.  
  52. It is obvious from the constraints of memory layout for arrays and
  53. pointer arithmetic, that a+200 would have pointed to a[2][0] if it
  54. were valid. However, the standard has declared a+200 to invoke
  55. undefined behaviour. Thus, a very strict bounds checking
  56. implementation can reject such pointer arithmetic without violating
  57. the standard.
  58.  
  59. Cheers
  60. Tanmoy
  61. --
  62. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  63. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  64. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  65. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  66. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  67. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  68.